<?php

namespace App\Models;

use DB;
use Illuminate\Database\Eloquent\Model;

class Complaint extends Model
{
    public $timestamps = false;
    protected $guarded = [];
    public static function groupWithCount($field)
    {
        $data = self::select([$field,DB::raw('Count('.$field.') as count')])->groupBy($field)->get();
        return $data;
    }
}